import 'package:flutter/material.dart';
import 'package:flutter_structure/app/app.dart';
import 'package:flutter_structure/app/app_init.dart';
import 'package:flutter_structure/utils/logger.dart';
import 'package:flutter_structure/utils/monitor.dart';

import 'common/config/config_path.dart';

Future <void> main() async  {
  WidgetsFlutterBinding.ensureInitialized(); // Flutter 框架初始化
  final monitor = Monitor();
  const String currentEnv = String.fromEnvironment('ENV', defaultValue: 'dev');
  AppConfig.init(currentEnv);
  Logger.info("当前环境${AppConfig.env.environment}" , tag: "main");
  Logger.info("当前Api${AppConfig.env.apiBaseUrl}" , tag: "main");
  monitor.mark("mainStart");

  await appInit();
  monitor.mark("appInit");

  // 启动帧率监控
  monitor.startFPSMonitoring();

  runApp(const App());
}
